package com.gxuwz.medical.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.gxuwz.medical.domain.chronicdis.Chronicdis;
import com.gxuwz.medical.domain.chronicinfo.ChronicInfo;
import com.gxuwz.medical.domain.person.Person;
import com.gxuwz.medical.exception.PersonNotFoundException;

/**
 * 慢性病信息查询DAO类
 * 
 * @author 演示
 * 
 */
public class ChroniInfoDao extends GenericDao<ChronicInfo> {

	@Override
	protected ChronicInfo handle(ResultSet rs) throws SQLException {

		ChronicInfo entity = new ChronicInfo();

		entity.setId(rs.getString("id"));

		try {
			entity.setPerson(new Person(rs.getString("perscode")));
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			entity.setChronicdis(new Chronicdis(rs.getString("illcode")));
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		entity.setStarttime(rs.getString("starttime"));
		entity.setEndtime(rs.getString("endtime"));
		entity.setStatus(rs.getString("status"));
		entity.setCreattime(rs.getDate("creattime"));
		entity.setCreator(rs.getString("creator"));

		return entity;
	}

}
